Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust parse / tryParse #558

Merged
merged 5 commits into from
Oct 13, 2023
Merged

Adjust parse / tryParse #558

merged 5 commits into from
Oct 13, 2023

Conversation

gusty
Copy link
Member

@gusty gusty commented Oct 2, 2023

Functions parse and tryParse should behave the same, the only difference should be in throwing or returning None.

@gusty gusty marked this pull request as ready for review October 2, 2023 13:40
@@ -139,6 +163,15 @@ type Parse =
| _ -> invalidArg "value" ("Requested value '" + x + "' was not found.")
) : 'enum

#if !FABLE_COMPILER
static member Parse (_: DateTime , _: Parse) = fun (x:string) ->
try DateTime.ParseExact (x, [|"yyyy-MM-ddTHH:mm:ss.fffZ"; "yyyy-MM-ddTHH:mm:ssZ"|], null, DateTimeStyles.RoundtripKind)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the TryParse implementation be used instead?

Copy link
Member

@wallymathieu wallymathieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it looks better in the TryParse case.

@gusty gusty force-pushed the master branch 2 times, most recently from c718153 to 3962979 Compare October 8, 2023 07:27
@gusty gusty merged commit cc644dc into master Oct 13, 2023
8 checks passed
@gusty gusty deleted the gus/parse-tryparse branch February 12, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants